package sitedao

import (
	"errors"
	"fmt"
	"hft/Database/admin"
	"hft/e"

	"gorm.io/gorm"
)

type SiteAccount struct{}

// 封禁所有的关联账号
func (s *SiteAccount) BanAllAccountBelongSite(accountLink string, accountID int, db *gorm.DB) (err error) {
	var link = fmt.Sprintf("%v%v,%%", accountLink, accountID)
	err = db.Model(&admin.Account{}).Where("account_link LIKE ?", link).Update("status", 0).Error
	if err != nil {
		return errors.New(e.ErrorInfo)
	}
	return nil
}

var SiteAccountDao = new(SiteAccount)
